<!-- 重大事项 -->
<template>
  <div>
    <div class="module">
      <span
        :class="{on:idx==index}"
        v-for="(item,index) in moduleData"
        :key="index"
        @click="moduleClick(item,index)"
      >{{item.name}}</span>
    </div>
    <div class="table w1021" v-if="type=='guarantee'">
      <div class="tableTh tableTr flex">
        <span class="tableTd w130 high">截止日期</span>
        <span class="tableTd w130 high">担保起始日</span>
        <span class="tableTd w130 high">担保终止日</span>
        <span class="tableTd w130 high">
          担保金额
          <br />（万元）
        </span>
        <span class="tableTd w90 high">币种</span>
        <span class="tableTd w130 high">担保类型</span>
        <span class="tableTd w90 high">关联交易</span>
        <span class="tableTd w220 high">担保方</span>
        <span class="tableTd w220 high">被担保方</span>
      </div>
      <div class="tableTr tableBody top flex" v-for="(item,index) in listData" :key="index">
        <span class="orange tableTd w130 high">{{item.reportDate|filterVal}}</span>
        <span class="orange tableTd w130 high">{{item.guarStartDate|filterVal}}</span>
        <span class="orange tableTd w130 high">{{item.guarEndDate|filterVal}}</span>
        <span class="orange tableTd w130 high">{{item.guarMoney|filterVal("wy")}}</span>
        <span class="orange tableTd w90 high">{{item.currency|filterVal}}</span>
        <span class="orange tableTd w130 high">{{item.guarType|filterVal}}</span>
        <span class="orange tableTd w90 high">{{item.guarRel|filterVal}}</span>
        <span class="orange tableTd w220 high">{{item.guarName|filterVal}}</span>
        <span class="orange tableTd w220 high">{{item.guardName|filterVal}}</span>
      </div>
      <div class="tableNone orange w1021 top" v-if="listData.length==0">暂无数据</div>
    </div>
    <div class="table w1021" v-if="type=='lawsuit'">
      <div class="tableTh tableTr flex">
        <span class="tableTd w130 high">公告日期</span>
        <span class="tableTd w130 high">诉讼事项</span>
        <span class="tableTd w220 high">涉案金额（万元）</span>
        <span class="tableTd w90 high">币种</span>
        <span class="tableTd w350 high">原告</span>
        <span class="tableTd w220 high">被告</span>
      </div>
      <div class="tableTr tableBody top flex" v-for="(item,index) in listData" :key="index">
        <span class="orange tableTd w130 high">{{item.declareDate|filterVal}}</span>
        <span class="orange tableTd w130 high">{{item.brief|filterVal}}</span>
        <span class="orange tableTd w220 high">{{item.invoMoney|filterVal("no")}}</span>
        <span class="orange tableTd w90 high">{{item.currency|filterVal}}</span>
        <span class="orange tableTd w350 high">{{item.prosecutor|filterVal}}</span>
        <span class="orange tableTd w220 high">{{item.defender|filterVal}}</span>
      </div>
      <div class="tableNone orange w1021 top" v-if="listData.length==0">暂无数据</div>
    </div>
    <div class="table w1021" v-if="type=='punish'">
      <div class="tableTh tableTr flex">
        <span class="tableTd w100 high">公告日期</span>
        <span class="tableTd w90 high">处罚类型</span>
        <span class="tableTd w90 high">处罚部门</span>
        <span class="tableTd w542 high">违规行为</span>
        <span class="tableTd w220 high">处罚内容</span>
      </div>
      <div class="tableTr tableBody top flex" v-for="(item,index) in listData" :key="index">
        <span class="orange tableTd w100 high">{{item.declareDate|filterVal}}</span>
        <span class="orange tableTd w90 high">{{item.punishType|filterVal}}</span>
        <span class="orange tableTd w90 high">{{item.organization|filterVal}}</span>
        <span class="orange tableTd w542 high">{{item.affair|filterVal}}</span>
        <span class="orange tableTd w220 high">{{item.punish|filterVal}}</span>
      </div>
      <div class="tableNone orange w1021 top" v-if="listData.length==0">暂无数据</div>
    </div>
    <div v-if="type=='pledge'">
      <div class="mt15">资产抵押</div>
      <div class="table w1021 mt15">
        <div class="tableTh tableTr flex">
          <span class="tableTd w130 high">公告日期</span>
          <span class="tableTd w130 high">抵押资产类型</span>
          <span class="tableTd w350 high">抵押资产详情</span>
          <span class="tableTd w130 high">抵押资产账面价值（万元)</span>
          <span class="tableTd w130 high">抵押人</span>
          <span class="tableTd w130 high">抵押权人</span>
          <span class="tableTd w130 high">抵押期限（月）</span>
          <span class="tableTd w130 high">交易简介</span>
        </div>
        <div class="tableTr tableBody top flex" v-for="(item,index) in pledge_w" :key="index">
          <span class="orange tableTd w130 high">{{item.declareDate|filterVal}}</span>
          <span class="orange tableTd w130 high">{{item.guarType|filterVal}}</span>
          <span class="orange tableTd w350 high">{{item.trdBrief|filterVal}}</span>
          <span class="orange tableTd w130 high">{{item.guarValue|filterVal("no")}}</span>
          <span class="orange tableTd w130 high">{{item.mortgagor|filterVal}}</span>
          <span class="orange tableTd w130 high">{{item.mortgagee|filterVal}}</span>
          <span class="orange tableTd w130 high">{{item.plePeriod|filterVal}}</span>
          <span class="orange tableTd w130 high">{{item.guaranty|filterVal}}</span>
        </div>
        <div class="tableNone orange w1021 top" v-if="pledge_w.length==0">暂无数据</div>
      </div>
      <div class="mt15">股权质押</div>
      <div class="table w1021 mt15">
        <div class="tableTh tableTr flex">
          <span class="tableTd w130 high">公告日期</span>
          <span class="tableTd w175 high">股东名称</span>
          <span class="tableTd w175 high">质押方</span>
          <span class="tableTd w130 high">质押股数(万股)</span>
          <span class="tableTd w130 high">质押起始日</span>
          <span class="tableTd w130 high">质押到期日</span>
          <span class="tableTd w130 high">解压日期</span>
          <span class="tableTd w90 high">质押简介</span>
        </div>
        <div class="tableTr tableBody top flex" v-for="(item,index) in pledge_e" :key="index">
          <span class="orange tableTd w130 high">{{item.declareDate|filterVal}}</span>
          <span class="orange tableTd w175 high">{{item.holderName|filterVal}}</span>
          <span class="orange tableTd w175 high">{{item.impawnName|filterVal}}</span>
          <span class="orange tableTd w130 high">{{item.impawnNum|filterVal("no")}}</span>
          <span class="orange tableTd w130 high">{{item.impawnStartDate|filterVal}}</span>
          <span class="orange tableTd w130 high">{{item.impawnEndDate|filterVal}}</span>
          <span class="orange tableTd w130 high">{{item.unimpawnDate|filterVal}}</span>
          <span class="orange tableTd w90 high underline" v-if="item.impawnInfo">
            <el-tooltip placement="bottom-end" effect="light">
              <div slot="content">{{item.impawnInfo}}</div>
              <span>查看</span>
            </el-tooltip>
          </span>
          <span class="orange tableTd w90 high" v-else>--</span>
        </div>
        <div class="tableNone orange w1021 top" v-if="pledge_e.length==0">暂无数据</div>
      </div>
    </div>
  </div>
</template>

<script>
import { numberNo, number } from "../../script/api";
//  "pledge_e"(股权质押):[],
//  "lawsuit"(诉讼仲裁):[],
//  "punish"(违规处理):[],
//  "guarantee"(对外担保):[],
//  "pledge_w"(资产抵押):[]
const moduleData = [
  {
    name: "对外担保",
    type: "guarantee"
  },
  {
    name: "诉讼仲裁",
    type: "lawsuit"
  },
  {
    name: "违规处理",
    type: "punish"
  },
  {
    name: "抵押质押",
    type: "pledge"
  }
];
export default {
  data() {
    return {
      moduleData: moduleData,
      idx: 0,
      type: "guarantee",
      listData: [],
      pledge_w: [],
      pledge_e: []
    };
  },
  props: {
    data: {
      type: Object,
      default: () => ({})
    }
  },
  watch: {
    data() {
      this.moduleClick(this.moduleData[0], 0);
    }
  },
  filters: {
    filterVal(ops, num) {
      if (num == "wy") {
        return number(ops, num, 10000);
      }
      if (num == "no") {
        return numberNo(ops, num);
      }
      return ops ? ops : "--";
    }
  },
  components: {},
  computed: {},
  mounted() {},
  methods: {
    moduleClick(item, index) {
      this.idx = index;
      this.type = item.type;
      if (item.type == "pledge") {
        this.pledge_w = this.data["pledge_w"];
        this.pledge_e = this.data["pledge_e"];
      } else {
        this.listData = this.data[item.type];
      }
    }
  }
};
</script>
<style lang='scss' scoped>
</style>